package com.community.contents.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.community.common.core.utils.Result;
import com.community.contents.dto.PostDTO;
import com.community.contents.entity.DiscussEntity;
import com.community.contents.entity.PostEntity;
import com.community.contents.service.IPostService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 帖子
 *
 * @author hjs hjs@qq.com
 * @since 1.0.0 2023-02-21
 */
@RestController
@RequestMapping("contents/post")
@Api(tags="帖子")
public class PostController {
    @Autowired
    private IPostService postService;

    @PostMapping("page")
    public Result<Page<PostDTO>> page(@RequestBody Page<PostDTO> params){
        postService.pageDto(params);
        return new Result<Page<PostDTO>>().ok(params);
    }


    @PostMapping
    public boolean save(@RequestBody PostEntity dto){
        return postService.save(dto);
    }



}